package com.xbts.web.controller.manager;

import com.xbts.common.core.controller.BaseController;
import com.xbts.common.core.domain.AjaxResult;
import com.xbts.common.core.domain.CnWalletLog;
import com.xbts.common.core.domain.entity.SysUser;
import com.xbts.common.core.page.TableDataInfo;
import com.xbts.system.module.payment.service.ICnWalletLogService;
import com.xbts.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author llk
 * @Date 2023/8/15 9:47
 */
@Api(tags = "系统管理")
@RestController
@RequestMapping("/system/manager")
public class SystemManagerController extends BaseController {

    @Autowired
    private ISysUserService sysUserService;

    @Autowired
    private ICnWalletLogService cnWalletLogService;

    /**
     * 用户实名审核列表
     */
    @ApiOperation("用户实名审核列表")
    @ApiImplicitParam(name = "sysUser", value = "用户实体", dataType = "SysUser", dataTypeClass = SysUser.class)
    @PostMapping("/realNameVerificationList")
    public TableDataInfo realNameVerificationList(@RequestBody SysUser sysUser) {
        startPage(sysUser);
        return getDataTable(sysUserService.realNameVerificationList(sysUser));
    }

    /**
     * 用户实名审核
     */
    @ApiOperation("用户实名审核")
    @ApiImplicitParam(name = "sysUser", value = "用户实体", dataType = "SysUser", dataTypeClass = SysUser.class)
    @PostMapping("/audit")
    public AjaxResult audit(@RequestBody SysUser sysUser) {
        return sysUserService.audit(sysUser);
    }

    /**
     * 查询钱包列表 /充值费用中心/ 费用管理
     */
    @ApiOperation("查询钱包列表")
    @PostMapping("/walletLogList")
    public TableDataInfo walletLogList(@RequestBody CnWalletLog cnWalletLog) {
        startPage(cnWalletLog);
        return getDataTable(cnWalletLogService.selectCnWalletLogList(cnWalletLog));
    }

    /**
     * 查询钱包列表 /充值费用中心/ 费用管理
     */
    @ApiOperation("统计充值管理")
    @PostMapping("/statisticsWalletLogList")
    public AjaxResult statisticsWalletLogList(@RequestBody CnWalletLog cnWalletLog) {
        return success(cnWalletLogService.statisticsWalletLogList(cnWalletLog));
    }

    /**
     * 删除钱包日志
     */
    @ApiOperation("删除钱包日志")
    @PostMapping("/batchDeleteWalletLog")
    public AjaxResult batchDeleteWalletLog(@RequestBody List<String> ids) {
        return toAjax(cnWalletLogService.deleteCnWalletLogByIds(ids));
    }
}